package net.ssta.core.util.format;

import java.math.BigDecimal;

public class JavaIntegerFormat extends ValueObjectFormat
{
	private static Integer INTEGER_ZERO = new Integer(0);
	public int getInt(Object value)
	{
		return ((Integer)value).intValue();
	}
	
	public short getShort(Object value)
	{
		return ((Integer)value).shortValue();
	}
	
	public long getLong(Object value)
	{
		return ((Integer)value).longValue();
	}
	
	public float getFloat(Object value)
	{
		return ((Integer)value).floatValue();
	}
	
	public double getDouble(Object value)
	{
		return ((Integer)value).doubleValue();
	}
	
	public Boolean getJavaBoolean(Object value)	{ return (value != null && !INTEGER_ZERO.equals(value));}
	
	public BigDecimal getBigDecimal(Object value)
	{
		return value == null ? BigDecimal.ZERO : BigDecimal.valueOf((Integer)value);
	}
}
